/*
 * $Id: PDFExport.java,v 1.2 2003/05/18 20:05:12 znamenacek Exp $
 *
 * Copyright (c) Milan Jedlicka
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

package net.sf.vofce.export;

import java.io.*;

import org.apache.log4j.Category;

/** 
 * Template for exporting graphs into PDF format
 *
 * @author Milan Jedlicka
 */
public class PDFExport implements net.sf.vofce.export.Template {

	/** Logger instance. */
	protected static Category logger = Category.getRoot();
	
	/** Image Exporter instance */
	ImageExporter ie = null;
	
	String templateName;

	/** 
	 * Default constructor
	 * @param templateFile	the name of template
	 */
	public PDFExport(String templateName) {
		this.templateName = templateName;
	}

	public String getName() {
		return templateName;
	}

	public String getDescription() {
		return "Template exporting graph functions to PDF"; 
	}

	public String getExtension() {
		return "pdf";
	}
	
	public String getAuthor() {
		return "Milan Jedlicka";
	}
	
	public String getVersion() {
		return "1.0";
	}
	
	public void setImgExporter(ImageExporter ie) {
		this.ie = ie;
	}
	
	public void exportTo(File file) {
		if (ie != null) {
			ie.toPDF(file);
		} else {
			logger.error("PDFExport: No ImageExporter available");
		}
	}

	public String toString() {
		return this.templateName;
	}

	public int getType() {

		return TT_INTERNAL;
	}
}
